<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>航空系统提示</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --air-blue: #1a237e;
            --sky-blue: #2196F3;
            --cloud-white: #f8f9fa;
            --success-green: #4CAF50;
            --warning-red: #f44336;
        }

        body {
            font-family: 'Segoe UI', 'Arial Rounded', sans-serif;
            background: #f0f5ff;
            min-height: 100vh;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .message-card {
            background: white;
            padding: 2.5rem;
            border-radius: 8px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.1);
            max-width: 600px;
            text-align: center;
            border-top: 4px solid var(--air-blue);
        }

        .status-icon {
            width: 80px;
            height: 80px;
            margin: 0 auto 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: var(--air-blue);
        }

        .message-content {
            font-size: 1.2rem;
            color: #2c3e50;
            margin: 1.5rem 0;
            line-height: 1.6;
            font-weight: 500;
        }

        .redirect-info {
            color: #546e7a;
            margin-top: 2rem;
            font-size: 0.95rem;
        }

        .manual-link {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            margin-top: 1.5rem;
            padding: 12px 24px;
            background: var(--air-blue);
            color: white !important;
            text-decoration: none;
            border-radius: 4px;
            transition: background 0.2s;
        }

        .manual-link:hover {
            background: var(--sky-blue);
        }

        #countdown {
            font-weight: 700;
            color: var(--air-blue);
            font-size: 1.2em;
        }

        /* 状态指示 */
        .success .message-card { border-color: var(--success-green); }
        .error .message-card { border-color: var(--warning-red); }
        .success .status-icon { background: var(--success-green); }
        .error .status-icon { background: var(--warning-red); }
    </style>
    <c:if test="${not empty redirectUrl}">
        <meta http-equiv="refresh" content="${waitSeconds};url=${redirectUrl}">
    </c:if>
</head>
<body>
    <div class="message-card ${status}">
        <div class="status-icon">
            <c:choose>
                <c:when test="${status eq 'success'}">
                    <i class="fas fa-check-circle fa-2x" style="color: white;"></i>
                </c:when>
                <c:when test="${status eq 'error'}">
                    <i class="fas fa-exclamation-triangle fa-2x" style="color: white;"></i>
                </c:when>
                <c:otherwise>
                    <i class="fas fa-info-circle fa-2x" style="color: white;"></i>
                </c:otherwise>
            </c:choose>
        </div>

        <div class="message-content">
            ${not empty message ? message : '操作已完成'}
        </div>

        <c:if test="${not empty redirectUrl}">
            <div class="redirect-info">
                <p>页面将在 <span id="countdown">${waitSeconds}</span> 秒后自动返回</p>
                <a href="http://localhost:8080/flight/${redirectUrl}" class="manual-link">
                    <i class="fas fa-arrow-right"></i>
                    立即跳转
                </a>
            </div>
        </c:if>
    </div>

    <c:if test="${not empty redirectUrl}">
    <script>
        (function() {
            let seconds = ${waitSeconds};
            const countdownEl = document.getElementById('countdown');
            const update = () => {
                countdownEl.textContent = seconds--;
                if(seconds >= 0) setTimeout(update, 1000);
            };
            update();
        })();
    </script>
    </c:if>
</body>
</html>